// uart_test.c

#include "uart_test.h"


static uint8_t recvBuf[10];  // ���ڽ������ݵĻ�����
static uint8_t temp;
static uint8_t index = 0;

void Uart_RxTxTest_Run(void)
{
    if (HAL_UART_Receive(&huart6, &temp, 1, 100) == HAL_OK)
    {
        recvBuf[index++] = temp;
			  printf("[UART2] Received: 0x%02X ('%c')\r\n", temp, (temp >= 32 && temp <= 126) ? temp : '.');

        if (temp == '\n' || index >= sizeof(recvBuf))   // 接收到换行符或超出最大长度
        {
					  
					  //HAL_GPIO_WritePin(USART6_EN_GPIO_Port,USART6_EN_Pin,GPIO_PIN_SET);
            HAL_UART_Transmit(&huart6, recvBuf, index, 100);
					
					  for (int i = 0; i < index; i++)
						{
								printf("%02X ", recvBuf[i]);
						}
						printf("\r\n");
            index = 0;  // ����´ν���
						//HAL_GPIO_WritePin(USART6_EN_GPIO_Port,USART6_EN_Pin,GPIO_PIN_RESET);
						
        }
    }
}